package com.boscloud.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.boscloud.pojo.GetProductionInboundInfo;
import com.boscloud.pojo.ProductionVerifyMateriel;
import com.boscloud.pojo.PostGoodMvtResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.boscloud.service.ProductionVerifyMaterielService;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin //允许跨域
@RestController
public class ProductionVerifyMaterielController {
    @Autowired
    private ProductionVerifyMaterielService ProductionVerifyMaterielService;
    @PostMapping("/ProductionVerifyMateriel")//扫描条码--获取生产确认入库信息(批次+物料)
    public List<ProductionVerifyMateriel> getProductionVerifyMateriel(@RequestBody Map<String, Object> params) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("PORTID","ITMS009");//接口ID
        return ProductionVerifyMaterielService.getProductionVerifyMateriel(params,headers);
    }
    @PostMapping("/PostProductionVerify")//生产确认入库
    public List<PostGoodMvtResult> PostProductionVerify(@RequestBody ProductionVerifyMateriel ProductionVerifyMateriel) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("PORTID","ITMS014");//接口ID
        Map<String, Object> params  = JSONObject.parseObject(JSON.toJSONString(ProductionVerifyMateriel));
        return ProductionVerifyMaterielService.PostProductionVerifyMateriel(params,headers);
    }
}
